package com.hylanda.processor.database.util;

import java.sql.Connection;
import java.sql.DriverManager;

/** 
 * @author zhangy
 * @E-mail:blackoon88@gmail.com 
 * @qq:846579287
 * @version created at：2017年9月14日 上午9:57:56 
 * note
 */
public class MysqlHelper extends DatabaseAbstractHelper {
	
	private static final String mysqlDriver = "com.mysql.jdbc.Driver";
	
	// 返回Connection对象
	public static Connection connectDb(String hostname,String connectDatabaseName,String username, String password) throws Exception {
		
		Connection conn = null;
		// String driver = "oracle.jdbc.driver.OracleDriver";
		// String url = "jdbc:oracle:thin:@localhost:1521:orcl";
		// String user = "cangzhen";
		// String password = "123";
		Class.forName(mysqlDriver);
		conn = DriverManager.getConnection("jdbc:mysql://"+hostname+"/"+connectDatabaseName+"?characterEncoding=UTF-8", username, password);
		
		return conn;
	}
	
}
